-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(libutil/tarfile): normalize legacy HTTP Content-Encoding names #14417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Nix failed to download files served with `Content-Encoding: x-gzip` because libarchive doesn't recognize the legacy `x-*` compression format names. Per RFC 9110 §8.4.1.3, HTTP recipients should treat these as equivalent to their standard counterparts. Adds `normalizeCompressionMethod()` to map legacy encoding names before passing to libarchive: - `x-gzip` → `gzip` - `x-compress` → `compress` - `x-bzip2` → `bzip2`
xokdvium
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that what we should do is stop using strings to represent enumeration types. We confuse compression algorithm name used by libarxhive and our non-standard Content-Enxoding headers. Those need to become clearly separated
you mean libarchive has enum types for compression? |
It doesn't unfortunately, but we really should have our own to wrap around libarchive. |
|
I agree that making our own enum sounds like the right call. |
tomberek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can refactor into enum in another PR.
xokdvium
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that must only affect Content-Encoding parsing. e.g. it must not be possible to specify the deprecated name as the store parameter. Since there's currently no distinction in the code it's a no-go IMO.
|
fwiw I agree the enum approach is better here, just haven't found the time to do it |
I have some WIP commits for that. In the meantime I don't see a need to rush. This (not accepting deprecated non-standard aliases) is not a regression. |
Motivation
Nix failed to download files served with
Content-Encoding: x-gzipbecause libarchive doesn't recognize the legacy
x-*compressionformat names. Per RFC 9110 §8.4.1.3, HTTP recipients should treat
these as equivalent to their standard counterparts.
Adds
normalizeCompressionMethod()to map legacy encoding namesbefore passing to libarchive:
x-gzip→gzipx-compress→compressx-bzip2→bzip2Context
Fixes: #14324
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.